package com.ChenYaRou.www.dao;

import com.ChenYaRou.www.po.Ticket;

import java.sql.SQLException;
import java.util.List;

/**
 *
 * @author 86183
 */
public interface TicketDao {
    /**
     * 查找抵用券集合
     * @param ticket 仅赋值条件的抵用券
     * @return 抵用券集合
     * @throws IllegalAccessException
     * @throws SQLException
     * @throws NoSuchFieldException
     * @throws InstantiationException
     */
    List<Ticket> select(Ticket ticket) throws IllegalAccessException,
            SQLException, NoSuchFieldException, InstantiationException;

    /**
     * update ticket state
     * @param newTicket ticket需要更新的值
     * @param  oldTicket old ticket
     * @return 成功与否
     * @throws IllegalAccessException
     * @throws SQLException
     */
    int update(Ticket newTicket,Ticket oldTicket) throws IllegalAccessException, SQLException;
    /**
     * 插入抵用券
     * @param ticket 新抵用券
     * @return 更新条数
     * @throws IllegalAccessException
     * @throws SQLException
     */
    int insert(Ticket ticket) throws IllegalAccessException, SQLException;

    /**
     * 所有ticket查找
     * @return
     * @throws SQLException
     * @throws NoSuchFieldException
     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    List<Ticket> selectAll() throws SQLException, NoSuchFieldException, InstantiationException, IllegalAccessException;
}
